package eventbus

var eventBus = NewEventBus()

// 发布
func Publish(topic string, message Message) {
	eventBus.Publish(topic, message)
}

// 订阅
func Subscribe(topic string, handler EventHandler) {
	eventBus.Subscribe(topic, handler)
}

// 注册请求处理器
func RegisteHandler(topic string, handler RequestHandler) (err error) {
	err = eventBus.RegisteHandler(topic, handler)
	return
}

// 请求应答
func RequestHandle(topic string, message Message) (ack *Message, err error) {
	ack, err = eventBus.RequestHandler(topic, message)
	return
}
